POV-Ray : Newsgroups : povray.newusers : Heighfields -are they meshes or 'just' textures? : Re: Heighfields -are they meshes or 'just' textures? Server Time
4 Sep 2024 20:19:01 EDT (-0400)
  Re: Heighfields -are they meshes or 'just' textures?  
From: krus
Date: 15 Aug 2002 05:25:04
Message: <web.3d5b72eee9a1db2d2f4bd1e30@news.povray.org>
Christopher James Huff wrote:
>In article <web.3d5a53a1e9a1db2d2f4bd1e30[at]news.povray.org>,
> "krus" <nomail[at]nomail> wrote:
>
>> >>Marc thats sound VERY interesting! -But i'm not sure if i understand *s*
>> Certently i do NOT understand the 'function' keyword in the macro.
>> This is what i got:
>>
>> could you show me what 'Function' could/should be. I've tried whith
>> x=1, 1*x, 0, x^1, ..all because i do not want the image to change
>> I get a parse-error with all the abowe
>> ....also the four '????' do not work ;)
>
>Hmm, that's...not even close. Never used macros before?
>You don't need the #macro...#end in the macro call, they are only used
>to define the macro. And you aren't supposed to use it in a
>height_field, the macro generates a new mesh primitive.
>
>These macros are well documented in the manual, and there are examples
>in scenes/incdemo/shapes.pov. You would use something like:
>
>#declare HF_Fn =
>function {
>    pigment {
>        image_map {sys "textAdv.bmp" interpolate 2}
>        rotate x*90
>    }
>}
>
>object {
>    HF_Square(function {HF_Fn(x, y, z).gray}, false, false, <100, 100>,
>true, "myMapMesh", < 0, 0, 0>, < 1, 1, 1>)
>    pigment {White}
>    translate <-.5, -.5, -.5>
>    scale <17, 1.975, 17>
>}
>
>HF_Fn is a pigment function, it gives the color of a pigment at a point.
>The ".gray" in the function given to the macro turns it into a float
>value useable as a height. The rotation by x*90 is necessary because the
>image_map is in the xy plane and you need it in the xz plane.
>You specified a mesh resolution of 1*1, which obviously won't work...I
>used 100*100, you should use something close to the size of your image
>file, though you could reduce it for lower-quality meshes. You specified
>"smooth" in your height field, so I assumed you wanted a smooth height
>field from the macro and set that option to true. And specifying "100"
>for both corners of the box containing the height field won't work, I
>specified < 0, 0, 0> and < 1, 1, 1>, like the built-in height_field
>shape.
>And note that "myMapMesh" won't be affected by the texture and
>translations you do to the object. You could adjust the pigment given to
>HF_Fn and the size given to the height field macro to generate a height
>field of the desired size instead, for texturing you would have to
>manually edit the generated file, but I think the conversion program
>will ignore it anyway.
>
>Christopher James Huff <cja### [at] earthlinknet>
>http://home.earthlink.net/~cjameshuff/
>POV-Ray TAG: chr### [at] tagpovrayorg
>http://tag.povray.org/
>

Christopher James Huff
THANK YOU! not only for the valuable and detailed help but especially for
the hint to the examples in shapes.pov!

Still there's one problem with the code.
I do get a normal picture if i omit the filename eg:

HF_Square(function {HF_Fn(x, y, z).gray}, false, false, <100, 100>,
true, "", < 0, 0, 0>, < 1, 1, 1>)

But if i ad a file:

HF_Square(function {HF_Fn(x, y, z).gray}, false, false, <100, 100>,
true, "myMapMesh", < 0, 0, 0>, < 1, 1, 1>)

-I get a parse-error:
" expected 'object' translate found instead"

-on the other hand, a file IS made and written to hd and i have opened it
and it seams to contain the correct information:

mesh2
{
 vertex_vectors 10000,{....}//{..some thousend vectors..}
  normal_vectors 10000, {....}
 face_indices 19602, {....}
}

I do have a problem with that file though -What is the file-type (eg
extension) for this file (believe it to be a mesh2-file? a .wrl-file?)

I fear that converting does something wrong with the file because the output
3ds-file is only 1 kb and contain no information at all.

I would greatly apreciate any help

regards krus


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.